======================================================================

Spillovers from High-Skill Consumption to Low-Skill Labor Markets
Francesca Mazzolari and Giuseppe Ragusa
REStat, March 2013, 95(1), 74-86

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Replication Files
----------------------------------------------------------------------


The replication files are included in two zip files:

1. replication_consumption.zip
2. replication_employment.zip

The first zip file contains all files needed to replicate tables and figures based on the Consumption Expenditure Survey (CEX).

The second zip file contains all files needed to replicate tables and figures based on CENSUS data.


Replication of Consumption Findings
--------------------------------

The steps needed to replicate the findings reported in the paper are the following:

1. Extract into a directory of choice all files from the ZIP file "replication_consumption.zip"
2. Edit the two do files saved in the "do" folder by setting the working directory as the one where the files were unzipped
3. Run the do files

On a Linux machine the following steps replicate the results (assume the STATA excecutable is on the path):

	unzip replication_consumption.zip -d ~/scratch/Rep
	cd ~/scratch/Rep/replication_consumption
	stata -b do 01_cex.do
	stata -b do 02_cex.do


Description of relevant code files:
- do/01_cex.do: This do file generates the dataset cex_diary04.dta that pools 4 quarters of data from FAMILY, MEMBER and EXPENDITURE files of the 2004 CEX Diary Survey

- do/02_cex.do: This do file generates relevant variables for the analysis run on a sample drawn from the 2004 CEX Diary Survey.  The working sample is stored in the file diary04/cex_diary04.dta (generated by the do file 01_cex.do). The do file also contains the commands needed to replicate Table 1 and Figure 1 in the paper, as well as Table A1 and Figure A1 in the online appendix A.



Replication of Employment Findings
--------------------------------

The steps needed to replicate the findings reported in the paper are the following:

1. Extract into a directory of choice all files from the ZIP file "replication_employment.zip"
2. Edit the two do files saved in the "do" folder by setting the working directory as the one where the files were unzipped
3. Run the do files

On a Linux machine the following steps replicate the results (assume the STATA and the R excecutables are on the path):

	unzip replication_consumption.zip -d ~/scratch/Rep
	cd ~/scratch/Rep/replication_consumption/do
	stata -b do 01_cex.do
	stata -b do 02_cex.do
	stata -b do 03_cex.do
	R BATCH create-dta-files.R
	stata -b do 04_cex.do
	cd ~/scratch/Rep/replication_consumption/R
	R BATCH qr.R

** If the files are extracted to a different directory the path of all the do files must be changed accordingly.

** The execution time of 'create-dta-files.R' is of about 10 hours. For convenience the directory includes the genereated files 'Dcityears.dta' and 'cityears.dta' in the folder "data".


Description of relevant code files:

- do/01_census.do: This do file prepares an individual level dataset(indiv80_90_00_05.dta) that pools extracts from 1980 (1%)- 1990(1%)-2000(5%)censuses and the 2005 ACS files. The sample is restricted to individuals older than 16 that do not live in institutional or non-institutional group quarters. 

- do/02_census.do: This do file produces descriptive tables and figures:
  * Table B2 (in the on-line appendix B)
  * Figures 2 and 3 (in the paper)
  * Figures B1, B2 and B3 (in the on-line appendix B)

- do/03_census.do: This do file prepares the city-level datasets:
    1. msa80_90_00_05.dta: The generated variables are population figures(number of "bodies", as of the census year) and employment figures (number of hours worked, in the year prior to the census) by educational level and sector
    2. msa80_90_00_05_wg.dta: The generated variables are wage figures (mean and median hourly wages) by educational level and sector

- do/04_census.do: Analysis by MSA's 
   This do file:
     1. Generates log and changes of relevant variables in msa80_90_00_05.dta(generated by 03_census.do)
     2. Merges (sectoral) employment (hours worked) and population (# of people) figures by MSA and year from msa80_90_00_05.dta to Dcityears.dta
        (generated using R)
     3. Generates reg_on_Dcityyears.dta 
     4. Run regressions
		- Tables B.3a and B.3b (in the online appendix B)
		- Tables 2 and 3 (in the paper)

- R/create-dta-files.R: Generates year by metarea quantiles and shares. It outputs two files
	  - Dcityears.dta: values in differences
	  - cityears.dta : values in level

- R/qr.R: Quantile regression and quantile graph.



